home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / modula2 / 195 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: mail2news.demon.co.uk!nezumi.demon.co.uk
  2. From: Martin Tom Brown <Martin@nezumi.demon.co.uk>
  3. Newsgroups: comp.lang.modula2
  4. Subject: Re: Modula2 for C programmers?
  5. Date: Mon, 29 Jan 96 09:33:04 GMT
  6. Organization: Nezumi
  7. Message-ID: <822907984snz@nezumi.demon.co.uk>
  8. References: <4eh2d6$18d@seagoon.newcastle.edu.au>
  9. Reply-To: Martin@nezumi.demon.co.uk
  10. X-NNTP-Posting-Host: nezumi.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.29
  12. X-Mail2News-Path: nezumi.demon.co.uk
  13.  
  14. In article <4eh2d6$18d@seagoon.newcastle.edu.au>
  15.            peter@tesla.newcastle.edu.au "Peter Moylan" writes:
  16.  
  17. > When I first came to Modula-2 I used BITSET for things like
  18. > manipulating I/O ports; I imagine that Wirth had things like that
  19. > in mind when he put BITSET into the language.
  20.  
  21. Wasn't it intended simply as a packed array of BOOLEAN  
  22. from the bad old days when ram was expensive and in short supply?
  23.  
  24. > 2. Bit numbering: is bit 0 the leftmost bit, or the rightmost?
  25. >    People have been arguing over which of these two conventions
  26. >    is "best" for years, and neither camp has dominated
  27.  
  28. The irresistable force meets the immovable object.
  29.  
  30. > The ISO M2 standard does, I think, dictate a little-endian
  31. > ordering for BITSET.  (That's from memory; I've forgotten which
  32. > section I should look up.)  But that doesn't completely resolve
  33. > the problems that arise when, for example, you upgrade your
  34. > PC compiler from 16-bit to 32-bit support.
  35.  
  36. Oh dear! 
  37. I supose that is the purist solution. Define it arbitrarily. 
  38.  
  39. I had hoped that a definition of bit number might have been
  40. based on the system hardware architecture features so that the 
  41.     n th bit of a BITSET is always the 2^n bit in a CARDINAL
  42. This would be a VAL type conversion (rather than coercion).
  43. This is at least as natural and logical as defining the 
  44. REAL <> INTEGER, CARDINAL casts
  45.  
  46. An interesting diversion is that if the definition is as you describe
  47. then there is scope for confusion in the future if both are allowed:
  48. since    CAST(BITSET, x) <> VAL(BITSET, x)     on some systems.
  49. I suppose you get round this by not allowing VAL(BITSET,x).
  50.  
  51. > I remain convinced that BITSET should have been defined in
  52. > SYSTEM, so that it was clearly labelled as non-portable.
  53.  
  54. Seconded.
  55.  
  56. Regards,
  57. -- 
  58. Martin Brown  <martin@nezumi.demon.co.uk>     __                CIS: 71651,470
  59. Scientific Software Consultancy             /^,,)__/
  60.